﻿using System;

namespace 八皇后
{
    class Program
    {
        static void Main(string[] args)
        {
            DateTime start = DateTime.Now;
            Console.WriteLine("求解开始");


            Solution solution = new(8);
            solution.Dfs(0);

            int th = 1;
            foreach(var aspect in solution.result)
            {
                Console.WriteLine("=======================");
                Console.WriteLine($"方案{th++}");
                for(int i = 0; i < solution.n; i++)
                {
                    for(int j = 0; j < solution.n; j++)
                    {
                        if (j != aspect[i])
                        {
                            Console.Write(" _ ");
                        }
                        else
                        {
                            Console.Write(" Q ");
                        }
                    }
                    Console.WriteLine();
                }
                Console.WriteLine("=======================");
                Console.WriteLine();
            }

            DateTime end = DateTime.Now;
            Console.WriteLine("求解结束");

            Console.WriteLine($"耗时:{(end - start).TotalMilliseconds}毫秒");
        }
    }
}
